import { defineStore } from "pinia";
import {  ref } from "vue";
import { fetchParkInfoAPI } from "@/api/parkAPI/parkAPI.ts";
import type { Base, ParkIncome, ParkIndustryItem, ParkInfoType } from "@/type/parkType";


const useParkStore = defineStore("parkStore", () => {
  const base = ref<Base>();
  const parkIncome = ref<ParkIncome>();
  const parkIndustry = ref<ParkIndustryItem[]>();


  const fetchParkInfo = async () => {
    const { data }: { data: ParkInfoType } = await fetchParkInfoAPI();
    base.value = data.base;
    parkIncome.value = data.parkIncome;
    parkIndustry.value = data.parkIndustry;
  };

  return {
    fetchParkInfo,
    base,
    parkIncome,
    parkIndustry,

  };

});


export default useParkStore;
